// ===============================================================================
// scan: sequential scan of a large descriptor collection
// Created in September 2007 as a project for an Advanced Database Systems course
// (c) Reykjavik University, Björn Þór Jónsson, Kristleifur Daðason, Herwig Lejsek
// Contact author: Björn Þór Jónsson, Reykjavík University, bjorn@ru.is
// ===============================================================================

#ifndef INDEX
#define INDEX

// Defines the structure of the .indx files
struct IndexEntry
{
	int offset; // The page at which the cluster starts
	int pages;  // The number of pages in the cluster
	int size;   // The number of records in the cluster
	
	// the folowing is the structure of the Flexdescriptor.
	// int id;
	signed char centroid[0]; 
    // Specifies the center point of the cluster
};

// Since the dimensionality is not encoded in the 
// index entry, this function calculates it for us
static int getIndexEntryByteSize(int numDims)
{
	// here the id of the flexdescriptor has to be counted as well
	// as the three ints of the IndexEntry, hence sizeof(int)*4.
	return (sizeof(int) * 4) + ((sizeof(signed char) * numDims));
};

#endif
